#include <iostream>
#include <vector>
#include <memory>
class Vehicle{
    public:
        using ptr = std::shared_ptr<Vehicle>;
        virtual ptr clone()=0;

    private:
        int _price;
        std::string _engine;
};

class Bus: public Vehicle
{
    public:
        using ptr = std::shared_ptr<Bus>;
        Bus()=default;
        Bus(const Bus& other){
            std::cout<<"Bus(const Bus&)"<<std::endl;
        }
        virtual Vehicle::ptr clone()override{
            return std::make_shared<Bus>(*this);
        }
    private:
        int _bearing;
        
};

class Car: public Vehicle
{
    public:
        using ptr = std::shared_ptr<Car>;
        Car()=default;
        Car(const Car& other){
            std::cout<<"Car(const Car&)"<<std::endl;
        }
        virtual Vehicle::ptr clone()override{
            return std::make_shared<Car>(*this);
        }
    private:
        int _top_speed;
};
void cloneList(std::vector<Vehicle::ptr>& vs){
    std::vector<Vehicle::ptr> copyList;
    for(int i=0;i<vs.size();++i){
        copyList.push_back(vs[i]->clone());
    }
}

int main()
{
    std::vector<Vehicle::ptr> vehicles;
    Bus bus;
    Car car;
    for(int i=0;i<10;++i)
    {
        if(i%3==0){
            vehicles.push_back(bus.clone());
        }
        else
        {
            vehicles.push_back(car.clone());
        }
    }
    std::cout<<"----------------------------------------"<<std::endl;
    cloneList(vehicles);
    return 0;
}
